﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="menu.aspx.cs" Inherits="Manage_menu" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>menu</title>
    <link rel="stylesheet" href="skin/css/base.css" type="text/css" />
    <link rel="stylesheet" href="skin/css/menu.css" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script language="javascript" type="text/javascript" src="skin/js/frame/menu.js"></script>
    <script src="script/jquery.min.js" type="text/javascript"></script>
    <script src="script/jquery-ui.min.js" type="text/javascript"></script>
    
     <script language='javascript' type="text/javascript">
         var selectobjId;
         function setSelect(obj) {
             selectobjId = $(obj).attr("id");
             $("a").css("color","black");
             $(obj).css("color", "red");
         }
         function noSelect(obj) {
             $("a").css("color", "black");
             $("#" + selectobjId).css("color", "red");
         }
         function toSelect(obj) {
             $(obj).css("color", "red");
         }
    </script>
    <base target="main" />
</head>
<body target="main">
    <form id="form1" runat="server">
    <table width='99%' height="100%" border='0' cellspacing='0' cellpadding='0' >
      <tr>
        <td style='padding-left:3px;padding-top:8px;' valign="top">
        <%
            foreach (System.Data.DataRow row in dtModuleGroup.Rows)
            {
                GroupId = Convert.ToInt32(row["MenuId"]);
                GroupName = row["Name"].ToString();
                int tflag = 0;
                foreach(System.Data.DataRow dr in BindModule(GroupId).Rows) 
                {
                      int  MId= Convert.ToInt32(dr["MenuId"]);
                     
                     foreach (System.Data.DataRow pr in UserPermisionTb.Rows)
                     {
                        int tisSelect = Convert.ToInt32(pr["SELECT"]);
                  
                        int tsMenuId = Convert.ToInt32(pr["MenuId"]);
                        int tparentId = Convert.ToInt32(pr["ParentId"]);
                        if (tsMenuId ==MId&&tparentId == GroupId)
                        {
                            if (tisSelect == 1)
                            {
                                tflag = 1;
                            }
                            break;
                        }
                  
                    } 
                }
                if(tflag==1)
                {
                                     
		%>	   
        <dl class='bitem'>
            <dt style="text-align:left; padding-left:14px" onclick='showHide("items<%=GroupId%>_1")'><%=GroupName%></dt>
             <dd style='display:block;' class='sitem' id='items<%=GroupId%>_1'>
              <ul class='sitemu'>
        <%
            foreach (System.Data.DataRow row1 in BindModule(GroupId).Rows)
            {
                MenuName = row1["Name"].ToString();
                PageUrl = row1["PageUrl"].ToString();  
                int  MenuId= Convert.ToInt32(row1["MenuId"]);
                int flag = 0;
              
                foreach (System.Data.DataRow r in UserPermisionTb.Rows)
                {
                    int isSelect = Convert.ToInt32(r["SELECT"]);
                  
                    int sMenuId = Convert.ToInt32(r["MenuId"]);
                    int parentId = Convert.ToInt32(r["ParentId"]);
                    if (sMenuId == MenuId && parentId == GroupId)
                    {
                        if (isSelect == 1)
                        {
                            flag = 1;
                        }
                        break;
                    }
                  
                }
                if (flag == 1)
                {
                    PageUrl += "?MenuId=" + MenuId;   
        %>	
         <li style=" text-align:left; width:130px">
            
            <a id="amenulink<%=MenuId %>" onmouseover="toSelect(this)" onmouseout="noSelect(this)" onclick="setSelect(this)"  href="<%=PageUrl%>" ><%=MenuName%></a>
           
        </li>
        <%
                }
            }
        %>
            </ul>
           </dd>
         </dl>
         <%
                    }
            }
         %>	
	      </td>
      </tr>
    </table>

    </form>
</body>
</html>
